package com.zhhl.util;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class PropertieUtils
{
  private static final String CONFIG = "dataConfig";
  private static ResourceBundle CONFIG_RES = ResourceBundle.getBundle("dataConfig");

  public static String getString(String key)
  {
    try
    {
      return CONFIG_RES.getString(key);
    } catch (MissingResourceException localMissingResourceException) {
    }
    return "";
  }

  public static String getChineseString(String key)
  {
    try
    {
      return new String(CONFIG_RES.getString(key).getBytes("ISO-8859-1"), "UTF-8");
    } catch (Exception localException) {
    }
    return "";
  }

  public static int getInt(String key) {
    String value = getString(key);
    if (!isEmpty(value)) {
      try {
        return Integer.parseInt(value);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return 0;
  }

  public static boolean getBoolean(String key) {
    return "true".equals(getString(key));
  }

  public static boolean isEmpty(String value) {
    return (value == null) || ("".equals(value.trim()));
  }
}